package com.ycy.smartcourseselection.controller;

import com.ycy.smartcourseselection.common.ResData;
import com.ycy.smartcourseselection.dto.courseManage.CoManagesDTO;
import com.ycy.smartcourseselection.dto.token.TokenInfoDTO;
import com.ycy.smartcourseselection.dto.token.UserInfo;
import com.ycy.smartcourseselection.entity.CoManage;
import com.ycy.smartcourseselection.entity.OpenIdManage;
import com.ycy.smartcourseselection.service.CoManageService;
import com.ycy.smartcourseselection.service.OpenIdManageService;
import com.ycy.smartcourseselection.utils.TokenUtils;
import com.ycy.smartcourseselection.vo.login.ScanQrCodeRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "微信绑定管理")
@RestController
@RequestMapping("/openIdManage")
public class OpenIdManageController {
    @Resource
    private OpenIdManageService openIdManageService;

    @PostMapping("/updateWxBind")
    @ApiOperation("更换绑定微信")
    public ResData<Boolean> updateWxBind(@RequestBody OpenIdManage openIdManage) {
        return openIdManageService.updateWxBind(openIdManage);
    }

    @GetMapping("/bindWeiXinByQrCode")
    @ApiOperation(value = "绑定微信",notes = "前端轮询的方法,带用户id查询该用户id申请的二维码是否被扫描等信息")
    public ResData<ScanQrCodeRes> bindWeiXinByQrCode(String userId, String timeStamp) {
        return openIdManageService.bindWeiXinByQrCode(userId,timeStamp);
    }
}
